home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 11⁄3⁄89 / 0004-Re A bug with Suitca-Nov89 < prev    next >
Encoding:
Text File  |  1989-11-03  |  2.1 KB  |  84 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  SHAYER1      to D0377
  2.  
  3. Item forwarded  by  A33          to A34
  4.  
  5. Item    4551074                         1-Nov-89        14:09
  6.  
  7. From:   KNEPPER                         Knepper, Christopher
  8.  
  9. To:     NORVELL.J                       Norvell, Joel
  10.  
  11. cc:     MACAPP.TECH$                    MacApp Technical
  12.         FIFTHGENSYS                     Fifth Generation Sys, S Nauman,PRT
  13.         DISHON.D                        Dishon, Danny
  14.         SHAYER1                         Shayer, David
  15.  
  16. Sub:    Re: A bug with Suitcase.
  17.  
  18. Joel,
  19.  
  20. I had a similar problem when creating a popup menu of DAs with Suitcase II.
  21. Here's my solution to give you an alternative to the solution proposed by Steve
  22. Brecher. My solution works for a popup menu of installed DAs and I've tested it
  23. with/without Suitcase II. {Note that handling DAs and Fonts from TPopUp is
  24. essentially the same problem.}
  25.  
  26. The main advantage to my solution over Steve's is that it avoids altering
  27. MacApp source code and works with MacApp 2.0ß9 "as is".
  28.  
  29. First, create a dummy 'MENU' in your app's ".r" file:
  30.  
  31. resource 'MENU' (302) {
  32.    302,
  33.    textMenuProc,
  34.    allEnabled,
  35.    enabled,
  36.    "DAs:",
  37.    {}
  38. };
  39.  
  40. Then, (I assume you're using template views rather than procedural views)
  41. specify kNoResource as the rsrc ID in the view resource for the popup:
  42.  
  43.    root, 'DAs!',
  44.    { 80, 4 },
  45.    { 19, 168 }, sizeFixed, sizeFixed, shown, enabled,
  46.    Popup {
  47.    "TDAPopup",
  48.    0b0,
  49.    {2, 2},
  50.    notSizeable,
  51.    notDimmed,
  52.    notHilited,
  53.    doesntDismiss,
  54.    noInset,
  55.    systemFont,
  56.    kNoResource,
  57.    1,
  58.    30
  59.    },
  60.  
  61. Finally, the only method that you need to write is TDAPopUp.IRes,:
  62.  
  63. PROCEDURE TDAPopup.IRes(itsDocument: TDocument; itsSuperView: TView;
  64.       VAR itsParams: Ptr); OVERRIDE;
  65.    VAR
  66.    rsrcID : INTEGER;
  67.    aMenu : MenuHandle;
  68.    BEGIN
  69.    INHERITED IRes(itsDocument, itsSuperView, itsParams);
  70.    fRsrcID := 302;
  71.    aMenu := GetMenu(302);
  72.    { Don't die because resource not found - just return NIL handle }
  73.    FailResError;
  74.    IF aMenu <> NIL THEN
  75.    BEGIN
  76.    HNoPurge(Handle(aMenu));
  77.    InsertResMenu(aMenu,'DRVR',0);  { add DA names to menu }
  78.    END;
  79.    SetPopup(aMenu, 302, 1, False);
  80.    END;
  81.  
  82. -Chris
  83.  
  84.